#include <iostream>

int const maxn = 55;
bool v[maxn], h[maxn];

int main()
{
	int n;
	std::cin >> n;
	for (int i = 1, x, y; i <= n * n; i++) {
		std::cin >> x >> y;
		if (!h[x] && !v[y]) {
			std::cout << i << ' ';
			h[x] = v[y] = true;
		}
	}
}

